#include <windows.h> 
#include <iostream>
#include <string>
#import "C:\\Windows\\SysWOW64\\dm.dll" 
using namespace Dm;
using namespace std;
IdmsoftPtr dm;
int _tmain()
{
	HRESULT hr = E_FAIL;
	hr = CoInitialize(NULL);
	hr = dm.CreateInstance("dm.dmsoft");
	return 0;
}
int main()
{
	_tmain();
	Sleep(3000);
	for (int i = 1; i; i++)
	{
		string s;
		s = dm->FindPicEx(562, 578, 1389, 802, "1.bmp", "000000", 0.9, 0);
		if (s.size() != 0)
		{
			char a[100], b[100];
			int x, y;
			if (s[6] == ',')
			{
				sprintf(a, "%c%c%c%c", s[2], s[3], s[4], s[5]);
				sprintf(b, "%c%c%c", s[7], s[8], s[9]);
			}
			else
			{
				sprintf(a, "%c%c%c", s[2], s[3], s[4]);
				sprintf(b, "%c%c%c", s[6], s[7], s[8]);
			}
			x = atoi(a);
			y = atoi(b);
			SetCursorPos((x + 100) / 1.25, (y + 20) / 1.25);
			mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
			//Sleep(10);
			mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
			//Sleep(100);
		}
	}
	system("pause");
	return 0;
}